#!/bin/sh

source /usr/local/sccli/functions
INPUTFILE=/usr/local/sccli/clients
OUTPUTFILE=/etc/coyote/qos.classes

#BEGIN DESCRIPTION
#QoS, Controle de banda
#END DESCRIPTION

case $1 in
	mount)
	
	echo gerando arquivos de QoS

while read LINE;
do

echo define_class_sfq \"1:1\" \"1:11$(field code)\" $(field bandadown) $(field bandadown) $(field bandaup) $(field bandaup) $(field ip) '#' $(field name)
   

done < $INPUTFILE > $OUTPUTFILE
	;;
	
	
	reload)

	echo reinicalizando QoS
	/etc/rc.d/rc.qos > /tmp/qos.tmp 2> /tmp/qos.tmp-errors
	[ $(tail /tmp/qos.tmp | grep -c "QOS: init complete") -eq 1 ] && echo concluido
esac

